﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Administration;

namespace CodePlex.SharePointInstaller
{
    public static class KalitteUtil
    {
        public static List<SPWebConfigModification> GetWebConfigModification()
        {
            List<SPWebConfigModification> mods = new List<SPWebConfigModification>();

            SPWebConfigModification mod2 = new SPWebConfigModification();
            mod2.Path = "configuration";
            mod2.Name = "DataProviderFrameworkGroupModifications1";
            mod2.Owner = "KDPWebPart";
            mod2.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureSection;
            mod2.Value = "  <DataProviderFramework mapDataProvider=\"KDPWebPart.SharepointdMapDataProvider,KDPWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1f3e44f4662f5f11\"></DataProviderFramework>";
            mods.Add(mod2);

            SPWebConfigModification mod3 = new SPWebConfigModification();
            mod3.Path = "configuration/DataProviderFramework";
            mod3.Name = "DataProviderFrameworkGroupModifications2";
            mod3.Owner = "KDPWebPart";
            mod3.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureSection;
            mod3.Value = "<providers></providers>";
            mods.Add(mod3);

            SPWebConfigModification mod4 = new SPWebConfigModification();
            mod4.Path = "configuration/DataProviderFramework/providers";
            mod4.Name = "DataProviderFrameworkGroupModifications3";
            mod4.Owner = "KDPWebPart";
            mod4.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            mod4.Value = "<clear />";
            mods.Add(mod4);

            SPWebConfigModification mod5 = new SPWebConfigModification();
            mod5.Path = "configuration/DataProviderFramework/providers";
            mod5.Name = "DataProviderFrameworkGroupModifications4";
            mod5.Owner = "KDPWebPart";
            mod5.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            mod5.Value = "<add name=\"MSAS\" type=\"ServerPlatform.DataProvider.Providers.AnalysisServicesDataProvider,ServerPlatform,  Version=1.0.0.0, Culture=neutral, PublicKeyToken=1f3e44f4662f5f11\" description=\"Connect to Analysis Services Cube\"></add>";
            mods.Add(mod5);

            SPWebConfigModification mod6 = new SPWebConfigModification();
            mod6.Path = "configuration/DataProviderFramework/providers";
            mod6.Name = "DataProviderFrameworkGroupModifications5";
            mod6.Owner = "KDPWebPart";
            mod6.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            mod6.Value = "<add name=\"Sharepoint\" type=\"ServerPlatform.DataProvider.Providers.SharepointDataProvider,ServerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1f3e44f4662f5f11\" description=\"Connect to Sharepoint\"></add>";
            mods.Add(mod6);

            SPWebConfigModification mod7 = new SPWebConfigModification();
            mod7.Path = "configuration/DataProviderFramework/providers";
            mod7.Name = "DataProviderFrameworkGroupModifications6";
            mod7.Owner = "KDPWebPart";
            mod7.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            mod7.Value = "<add name=\"MSSQLServer\" type=\"ServerPlatform.DataProvider.Providers.SQLDataProvider,ServerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1f3e44f4662f5f11\" description=\"Connect to SQL Server Database\"></add>";
            mods.Add(mod7);





            SPWebConfigModification mod1 = new SPWebConfigModification();
            mod1.Path = "configuration/configSections";
            mod1.Name = "DataProviderFrameworkGroupModifications0";            
            mod1.Owner = "KDPWebPart";
            mod1.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            mod1.Value = "<section name=\"DataProviderFramework\" type=\"ServerPlatform.Configuration.DataProviderSection,ServerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1f3e44f4662f5f11\" />";
            mods.Add(mod1);




            //SPWebConfigModification mod8 = new SPWebConfigModification("httpHandlers", "configuration/system.web");
            //mod8.Owner = "KDPWebPart";
            //mod8.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod8.Value = "<remove path=\"*.asmx\" verb=\"*\" />";
            //mods.Add(mod8);

            //SPWebConfigModification mod9 = new SPWebConfigModification("httpHandlers", "configuration/system.web");
            //mod9.Owner = "KDPWebPart";
            //mod9.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod9.Value = "<add path=\"*.asmx\" verb=\"*\" type=\"System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" validate=\"false\" />";
            //mods.Add(mod9);

            //SPWebConfigModification mod10 = new SPWebConfigModification("httpHandlers", "configuration/system.web");
            //mod10.Owner = "KDPWebPart";
            //mod10.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod10.Value = "<add path=\"*_AppService.axd\" verb=\"*\" type=\"System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" validate=\"false\" />";
            //mods.Add(mod10);

            //SPWebConfigModification mod11 = new SPWebConfigModification("httpHandlers", "configuration/system.web");
            //mod11.Owner = "KDPWebPart";
            //mod11.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod11.Value = "<add path=\"ScriptResource.axd\" verb=\"GET,HEAD\" type=\"System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" validate=\"false\" />";
            //mods.Add(mod11);

            //SPWebConfigModification mod12 = new SPWebConfigModification("httpHandlers", "configuration/system.web");
            //mod12.Owner = "KDPWebPart";
            //mod12.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod12.Value = "<add verb=\"GET,HEAD\" path=\"map.axd\" type=\"ServerPlatform.Handlers.MapDataHandler, ServerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1f3e44f4662f5f11\" validate=\"false\" />";
            //mods.Add(mod12);

            //SPWebConfigModification mod13 = new SPWebConfigModification("httpModules", "configuration/system.web");
            //mod13.Owner = "KDPWebPart";
            //mod13.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod13.Value = "<add name=\"ScriptModule\" type=\"System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" />";
            //mods.Add(mod13);

            //SPWebConfigModification mod14 = new SPWebConfigModification("httpModules", "configuration/system.web");
            //mod14.Owner = "KDPWebPart";
            //mod14.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod14.Value = "<add name=\"AjaxRequestModule\" type=\"Kalitte.Dashboard.Framework.Modules.RequestModule, Kalitte.Dashboard.Framework\" />";
            //mods.Add(mod14);

            //SPWebConfigModification mod15 = new SPWebConfigModification();
            //mod15.Path = "configuration/system.web/compilation/assemblies";
            //mod15.Name = "DataProviderFrameworkGroupModifications7";
            //mod15.Owner = "KDPWebPart";
            //mod15.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod15.Value = "<add assembly=\"AjaxControlToolkit, Version=3.0.30930.28736, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e\" />";
            //mods.Add(mod15);

            //SPWebConfigModification mod16 = new SPWebConfigModification();
            //mod16.Path = "configuration/system.web/pages/controls";
            //mod16.Name = "DataProviderFrameworkGroupModifications8";
            //mod16.Owner = "KDPWebPart";
            //mod16.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod16.Value = "<add tagPrefix=\"asp\" namespace=\"System.Web.UI.WebControls\" assembly=\"System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\"/>";
            //mods.Add(mod16);

            //SPWebConfigModification mod17 = new SPWebConfigModification();
            //mod17.Path = "configuration/system.web/pages/controls";
            //mod17.Name = "DataProviderFrameworkGroupModifications9";
            //mod17.Owner = "KDPWebPart";
            //mod17.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod17.Value = "<add namespace=\"AjaxControlToolkit\" assembly=\"AjaxControlToolkit, Version=3.0.30930.28736, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e\" tagPrefix=\"cc1\" />";
            //mods.Add(mod17);

            //SPWebConfigModification mod18 = new SPWebConfigModification();
            //mod18.Path = "configuration/system.webServer/modules";
            //mod18.Name = "DataProviderFrameworkGroupModifications10";
            //mod18.Owner = "KDPWebPart";
            //mod18.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod18.Value = "<remove name=\"ScriptModule\" />";
            //mods.Add(mod18);

            //SPWebConfigModification mod19 = new SPWebConfigModification();
            //mod19.Path = "configuration/system.webServer/modules";
            //mod19.Name = "DataProviderFrameworkGroupModifications11";
            //mod19.Owner = "KDPWebPart";
            //mod19.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod19.Value = "<add name=\"ScriptModule\" preCondition=\"managedHandler\" type=\"System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" />";
            //mods.Add(mod19);

            //SPWebConfigModification mod20 = new SPWebConfigModification();
            //mod20.Path = "configuration/system.webServer/handlers";
            //mod20.Name = "DataProviderFrameworkGroupModifications12";
            //mod20.Owner = "KDPWebPart";
            //mod20.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod20.Value = "<remove name=\"KdpMapDataHandler\" />";
            //mods.Add(mod20);

            //SPWebConfigModification mod21 = new SPWebConfigModification();
            //mod21.Path = "configuration/system.webServer/handlers";
            //mod21.Name = "DataProviderFrameworkGroupModifications12";
            //mod21.Owner = "KDPWebPart";
            //mod21.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            //mod21.Value = "<add name=\"KdpMapDataHandler\" preCondition=\"integratedMode\" verb=\"GET,HEAD\" path=\"map.axd\" type=\"ServerPlatform.Handlers.MapDataHandler, ServerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1f3e44f4662f5f11\" />";
            //mods.Add(mod21);

            return mods;
        }
    }
}
